package com.xuecheng.media.interfaces.web;

import com.xuecheng.base.model.RestResponse;
import com.xuecheng.media.application.service.MediaFilesApplication;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-08-24  14:24
 */
@Api(tags = "媒资公开查询接口")
@RestController
@RequestMapping("/open")
public class MediaOpenApi {

    @Autowired
    private MediaFilesApplication mediaFilesApplication;

    @ApiOperation("预览文件")
    @GetMapping("/preview/{mediaId}")
    public RestResponse<String> openCourse(@PathVariable("mediaId") String mediaId){

        return RestResponse.success(mediaFilesApplication.getMediaFiesById(mediaId).getUrl());
    }
}
